<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
		<title>title</title>
		<link rel="stylesheet" type="text/css" href="../css/public-head.css" />
		<link rel="stylesheet" type="text/css" href="../css/api.css" />
		<link rel="stylesheet" href="../css/mui.css" />
		<link rel="stylesheet" type="text/css" href="../css/demo1.css" />
		<style>

		</style>
	</head>

	<body>
		<div id="shopList">
			<!--<div class='item-view'>
					<div class='shop-img-view'>
						<image class='shop-img' src='https://ccx-mini.oss-cn-shenzhen.aliyuncs.com/static/images/WechatIMG1292.png'></image>
					</div>
					<div class='shop-info-view'>
						<div class='shop-info-name'>{{item.shop_name}}</div>
						<div class='shop-info-address'>{{item.address}}</div>
						<div class='shop-info-juli'>距离:{{(item.geo_spacing)}}M</div>
					</div>
				</div>-->
		</div>
		<!--<div class='noorder'>
			<div>
				<image src='https://ccx-mini.oss-cn-shenzhen.aliyuncs.com/static/orders/noorder.png'></image>
			</div>
			<h1>附近暂无店铺</h1>
		</div>-->
	</body>
	<script type="text/javascript" src="../script/api.js"></script>
	<script type="text/javascript" src="../script/public-head.js"></script>
	<script type="text/javascript" src="../script/mui.js"></script>
	<script src="../script/template-web.js"></script>
	<!--门店列表模块-->
	<script type="text/html" id="shop_List">
		{{each data value index}}
		<div onclick="tokey_list({{value.id}})" class='context-view'>
			<div class='item-view'>
				<div class='shop-img-view'>
					<image class='shop-img' src='../image/icon/kefutx@2x.png'></image>
				</div>
				<div class='shop-info-view'>
					<div class='shop-info-name'>{{value.shop_name}}</div>
					<div class='shop-info-address'>{{value.address}}</div>
					<div class='shop-info-juli'>距离:{{(value.geo_spacing)}}M</div>
				</div>
			</div>
		</div>
		{{/each}}
	</script>
	<!--附近没有门店-->
	<script type="text/html" id="nullShop">
		<div class='noorder'>
			<div>
				<image src='https://ccx-mini.oss-cn-shenzhen.aliyuncs.com/static/orders/noorder.png'></image>
			</div>
			<h1>附近暂无店铺</h1>
		</div>
	</script>
	<script type="text/javascript">
		//头部
		headInner({
			title: "车车侠客服",
			//headleft
			headl: '<a href="#" style="color:white" class="mui-icon mui-icon-left-nav" tapmode onclick="api.closeWin()"></a>',
			//headright
			headr: '<a style="color:white"></a>',
			color: "", //默认是蓝色
			padding: "0px 0px 0px",
		})
		var shop_List = {
			"data": [{
				"id": 1,
				"shop_name": "万达银座店",
				"longitude": "108.375412",
				"latitude": "22.829043",
				"province": null,
				"city": "南宁市",
				"address": "广西壮族自治区南宁市青秀区金湖北路",
				"created_at": "2019-02-16 11:58:02",
				"shop_cover": [{
					"shop_id": 1,
					"url": "https://ccx-master.oss-cn-shenzhen.aliyuncs.com/shopCover/7P91pmBJokHqwyGldATC5BCTYZ8AAMQLFZD3Zsmm.jpeg"
				}],
				"cover": "https://ccx-mini.oss-cn-shenzhen.aliyuncs.com/static/images/WechatIMG1292.png",
				"order_counts": 3,
				"vacancy_cabinet": 47,
				"geo_spacing": "2.8538"
			}, {
				"id": 7,
				"shop_name": "金湖路分店",
				"longitude": "108.372359",
				"latitude": "22.817983",
				"province": "广西",
				"city": "南宁市",
				"address": "广西壮族自治区南宁市青秀区东悦巷6号",
				"created_at": "2019-04-30 11:33:32",
				"shop_cover": [{
					"shop_id": 7,
					"url": "https://ccx-master.oss-cn-shenzhen.aliyuncs.com/shopCover/5s8MLIItJVfkri8FzNom4odzRS5BaMRCk0TEJg7k.jpeg"
				}],
				"cover": "https://ccx-mini.oss-cn-shenzhen.aliyuncs.com/static/images/WechatIMG1292.png",
				"order_counts": 0,
				"vacancy_cabinet": 20,
				"geo_spacing": "1272.3360"
			}, {
				"id": 9,
				"shop_name": "永凯春晖分店",
				"longitude": "108.391247",
				"latitude": "22.813587",
				"province": "广西",
				"city": "南宁市",
				"address": "广西壮族自治区南宁市青秀区民族大道137号",
				"created_at": "2019-04-30 11:38:34",
				"shop_cover": [{
					"shop_id": 9,
					"url": "https://ccx-master.oss-cn-shenzhen.aliyuncs.com/shopCover/0vOluFsltlKziJT55HeOy3D5pGwbyX6uvuquPl4E.jpeg"
				}],
				"cover": "https://ccx-mini.oss-cn-shenzhen.aliyuncs.com/static/images/WechatIMG1292.png",
				"order_counts": 0,
				"vacancy_cabinet": 20,
				"geo_spacing": "2366.4455"
			}, {
				"id": 2,
				"shop_name": "保利二十一世家",
				"longitude": "108.395260",
				"latitude": "22.805566",
				"province": "",
				"city": "南宁市",
				"address": "广西壮族自治区南宁市青秀区中柬路6号",
				"created_at": "2019-02-22 12:32:45",
				"shop_cover": [{
					"shop_id": 2,
					"url": "https://ccx-master.oss-cn-shenzhen.aliyuncs.com/shopCover/psfWYObZNipYpHD2FkwcW7Oq3VXqmVeyZFbVNZiF.jpeg"
				}],
				"cover": "https://ccx-mini.oss-cn-shenzhen.aliyuncs.com/static/images/WechatIMG1292.png",
				"order_counts": 0,
				"vacancy_cabinet": 160,
				"geo_spacing": "3312.8661"
			}]
		}
		apiready = function() {
			init()
			if(!shop_List) {
				nullShop();
			} else {
				shopList();
			}
		};

		//门店模板
		function shopList() {
			//			console.log(JSON.stringify(shop_List))
			//模板id
			var html = template('shop_List', shop_List);
			//实际位置
			document.getElementById('shopList').innerHTML = html;
		}
		//附近没有门店
		function nullShop() {
			console.log("99999999")
			//模板id
			var html = template('nullShop', shop_List);
			//实际位置
			document.getElementById('shopList').innerHTML = html;
		}
		//初始化页面
		function init() {

		}

		//跳转到订单页面,并传递门店id
		function tokey_list(i) {
			api.openWin({
				name: 'demo2',
				url: '../html/demo2.html',
				pageParam: {
					shop_id: i
				}
			});
		}
	</script>

</html>